import Vue from 'vue'
import Vuex from 'vuex'

import { cookie } from '@/utils'

Vue.use(Vuex)

export default new Vuex.Store({
  strict: process.env.NODE_ENV !== 'production',
  state: {
    appId: 'wx0cb53d81f0c7b0cf',
    appSecret: 'ZDAxNWU2YzFkOWYyZjhjMzE5NzMyMTljNWYzOGUwYWY',
    // payMerId: '552651048165LLG', // 支付商户号要写死
    payMerId: '55165104816NKED', // 支付商户号要写死 20200317张兰珠发的

    test: false, // 测试开关
    // username: '15181851513',
    username: '',
    account: {
      providerId: '1000000000'
    },
    logo: '',
    startServiceTime: '',
    endServiceTime: ''
  },
  mutations: {
    SET_ACCOUNT_INFO: (state, info) => {
      Object.assign(state.account, info)
      cookie.set('account', state.account)

      if (info.logo) {
        state.logo = info.logo
      }
      if (info.startServiceTime) {
        state.startServiceTime = info.startServiceTime
      }
      if (info.endServiceTime) {
        state.endServiceTime = info.endServiceTime
      }
    }
  }
})
